package com.instalinks.android.smspostservice.widget;

import android.content.ComponentName;
import android.widget.RemoteViews;

import com.instalinks.android.smspostservice.R;

public class CallWidget extends ThinServerWidgetBase {

	@Override
	protected void updateStats() {

        mAppConfig.rePopulate();
        
        RemoteViews remoteViews;
        ComponentName thinServerWidget;

        remoteViews = new RemoteViews( mContext.getPackageName(), R.layout.call_widget);
        thinServerWidget = new ComponentName( mContext, CallWidget.class );

        remoteViews.setImageViewResource(R.id.wdg_call_imgServiceStatus, (mAppConfig.isServiceRunning() && mAppConfig.isMissedServiceServiceFlag()) ? R.drawable.start_ico
				: R.drawable.stop_ico);
        
        remoteViews.setTextViewText( R.id.wdg_call_txtCallSuccess, mAppConfig.getCallSuccessCount()+ "");
        remoteViews.setTextViewText( R.id.wdg_call_txtCallFailed, mAppConfig.getCallFailedCount() + "");
        
        
        mAppWidgetManager.updateAppWidget( thinServerWidget, remoteViews );
	}
}
